import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { PaymentApplicationVO, PaymentApplicationForm, PaymentApplicationQuery } from '@/pagesA/api/workflow/paymentApplication/types';

/**
 * 查询付款申请单列表
 * @param query
 * @returns {*}
 */

export const listPaymentApplication = (query?: PaymentApplicationQuery): AxiosPromise<PaymentApplicationVO[]> => {
  return request({
    url: '/workflow/paymentApplication/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询付款申请单详细
 * @param id
 */
export const getPaymentApplication = (id: string | number): AxiosPromise<PaymentApplicationVO> => {
  return request({
    url: '/workflow/paymentApplication/' + id,
    method: 'get'
  });
};

/**
 * 新增付款申请单
 * @param data
 */
export const addPaymentApplication = (data: PaymentApplicationForm) => {
  return request({
    url: '/workflow/paymentApplication',
    method: 'post',
    data: data
  });
};

/**
 * 修改付款申请单
 * @param data
 */
export const updatePaymentApplication = (data: PaymentApplicationForm) => {
  return request({
    url: '/workflow/paymentApplication',
    method: 'put',
    data: data
  });
};

/**
 * 删除付款申请单
 * @param id
 */
export const delPaymentApplication = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/paymentApplication/' + id,
    method: 'delete'
  });
};
